<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Mercado Legal</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <?php
        echo $this->headLink()
                ->prependStylesheet($this->baseUrl() . '/public/css/style.css')
                ->prependStylesheet($this->baseUrl() . '/public/css/jquery-ui.css')
                ->prependStylesheet($this->baseUrl() . '/public/css/bootstrap.css')
                ->prependStylesheet($this->baseUrl() . '/public/css/bootstrap-responsive.css') 
        ?>
        <style type="text/css">
            body {
                padding-top: 60px;
                padding-bottom: 40px;
            }
        </style>

        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
        <link rel="shortcut icon" href="../assets/ico/favicon.png">
    </head>
    <body>     
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header" style="padding-right: 20px">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#my-nav">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#" style="padding-left: 40px">Mercado Legal</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div id="my-nav" class="navbar-collapse collapse" style="padding-left: 40px">
                        <?php $session = new Zend_Session_Namespace('role'); ?>
                        <?php $usuario = DbTable_Usuario::buscarUsuarioPorId($session->idUsuario); ?> 
                        <ul class="nav navbar-nav">
                            <?php if ($session->role != Role::VISITANTE): ?>
                                <li class="active"><?php echo $this->href(array('controller' => 'index', 'action' => 'index', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-home"></i> Home', 'checkAcl' => true)) ?></li>
                                <?php  if ($session->role == Role::ADMINISTRADOR): ?>
                                    <li class="dropdown" id="menu-adm">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Administra&ccedil&atildeo<b class="caret"></b></a>
                                        <ul class="dropdown-menu">
                                            <li class="divider"></li>                                          
                                            <li><?php echo $this->href(array('controller' => 'produto', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-phone"></i> Gerenciar Produtos', 'checkAcl' => true)) ?></li>
                                            <li class="divider"></li>                                          
                                            <li><?php echo $this->href(array('controller' => 'mercado', 'action' => 'add-mercado-preferido', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-shopping-cart"></i> Gerenciar Mercados', 'checkAcl' => true)) ?></li>                                                              
                                            <li class="divider"></li>                                          
                                            <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-user"></i> Gerenciar Usu&aacute;rios', 'checkAcl' => true)) ?></li>                                                                                                          
                                        </ul>
                                    </li>
                            <?php endif; ?>
                            <li class="dropdown"> 
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-list-alt"></i> Lista de Compras<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li><?php echo $this->href(array('controller' => 'compra', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-list-alt"></i> Listar', 'checkAcl' => true)) ?></li>
                                    <li><?php echo $this->href(array('controller' => 'compra', 'action' => 'criar', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-plus-sign"></i> Criar', 'checkAcl' => true)) ?></li>
                                    <li><?php echo $this->href(array('controller' => 'compra', 'action' => 'ir-comprar', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-shopping-cart"></i> Ir &agrave;s Compras', 'checkAcl' => true)) ?></li>
                                </ul>
                            </li>
							<li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-cog"></i> Meu Ambiente<b class="caret"></b></a>
                        		<ul class="dropdown-menu">  
                                                <li style="margin-left: -20px; text-align: center;"><img src="https://graph.facebook.com/<?php echo $usuario->id_user_facebook ?>/picture?width=30&height=30" class="img-circle"  width="30" height="30" onerror="this.src='<?php echo $this->baseUrl()?>/public/img/avatar.jpg'"></li>
                                                <li class="hidden-responsivo"><?php echo $usuario->nm_pessoa?></li>
                                                <li class="divider"></li>                      			
                                                <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'board', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-cog"></i> Meu Ambiente', 'checkAcl' => true)) ?></li>
                                                <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'alterar-regiao-preferencia', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-screenshot"></i> Regi&atilde;o de Prefer&ecirc;ncia', 'checkAcl' => true)) ?></li>                                                
                                               	<li class="divider"></li>
                                                <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'linkar-conta-facebook', 'module' => 'default', 'content' => '<i class="glyphicon glyphicon-thumbs-up"></i> Vincular Conta com Facebook', 'checkAcl' => true)) ?></li>
                                                <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'alterar-senha', 'module' => 'default', 'content' => "<img src='{$this->baseUrl()}/public/img/chave.png' height='15' width='15'/> Alterar Senha", 'checkAcl' => true)) ?></li>                        			
                        		</ul>                        
                        	</li>
                        <?php endif; ?>
                        <li><?php echo $this->href(array('controller' => 'acesso', 'action' => 'logout', 'module' => 'default', 'content' => 'Sair', 'checkAcl' => true)) ?></li>
                        <?php if ($session->role == Role::VISITANTE): ?>
                        <li><?php echo $this->href(array('controller' => 'acesso', 'action' => 'login', 'module' => 'default', 'content' => 'Login', 'checkAcl' => true)) ?></li>
                        <?php endif; ?>
                        </ul>
						
						
                        <!-- <form class="navbar-form pull-right">
                          <input class="span2" type="text" placeholder="Buscar Produto">
                          <button type="submit" class="btn">Buscar</button>
                        </form>  -->
                    </div>
                
                
            </div><!-- /.container-fluid -->
        </nav>
        
        <div class="container-fluid">
        	<div class="row">
        		<div class="col-xs-12 col-sm-12 col-md-offset-2 col-md-10 col-md-offset-4 col-lg-8	"> 
		            <div class="alert alert-error" id="alert-error-rn"> 
		                <button type="button" class="close" data-dismiss="alert">&times;</button>
		                <strong>Ops!</strong> <span></span>
		            </div>
		            <?php echo $this->layout()->content; ?>
		            <hr>
		            <!--       <footer>
		            <p>Est&aacutegio de Desenvolvimento de Sistemas</p>
		          </footer> -->
		            <div id="baseUrl"><?= $this->baseUrl() ?></div>
	            </div>
            </div>
        </div>
    </body>
    <?php
    echo $this->headScript()->headScript()->prependFile($this->baseUrl() . '/public/js/javascript.js')
    		->prependFile($this->baseUrl() . '/public/js/tablesorter.js')
            ->prependFile($this->baseUrl() . '/public/js/bootstrap.min.js')
            ->prependFile($this->baseUrl() . '/public/js/jquery-ui.js')
            ->prependFile($this->baseUrl() . '/public/js/jquery.js')
            ;
    ?>
</html>